<%@ page import="com.the8thfold.anton.ant.AntJobUser; org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils; com.the8thfold.anton.users.Roles" %>
<g:formRemote onSuccess="jQuery('#notifiedTable').effect('highlight',{color: '#90ee90'},1000);" onFailure="jQuery('#notifiedTable').effect('highlight',{color: 'red'},1000);" name="users_form" url="[controller: 'job', action: 'updateUsers', id: job?.jobId]">
    <table id="notifiedTable">
        <tr>
            <th></th>
            <th>User</th>
        </tr>
        <g:each in="${AntJobUser.findAllByJob(job).collect {it.user}.sort { it.username}}" status="usersIndex" var="user">
            <td style="width: 1%;">
                <g:if test="${SpringSecurityUtils.ifAllGranted(Roles.ROLE_JOB_ADMIN.toString())}">
                    <input onchange="jQuery('#users_form').submit();" type="checkbox" name="users" id="${user.userId}" ${notifiedMap.get(user.userId)} value="${user.userId}" />
                </g:if>
                <g:else>
                    <g:if test="${notifiedMap.get(user.userId)}">
                        V
                    </g:if>
                </g:else>
            </td>
            <td>${user.firstName + " " + user.lastName}</td>
        </g:each>
    </table>
</g:formRemote>